package com.feng.leetcode;

public class Eleventh {
    public static void main(String[] args) {
        int[] in = new int[]{1,8,6,2,5,4,8,3,7};
        System.out.println(maxArea(in));
    }
    public static int maxArea(int[] height) {
        int ans = 0;
        for (int i = 0; i < height.length; i++) {
            for (int j = i+1; j < height.length; j++) {
                int result = (j-i) * Math.min(height[i],height[j]);
                ans = Math.max(ans,result);
            }
        }
        return ans;
    }
}
